package echecs;

import echecs.Pieces.Piece;
import echecs.Pieces.Piece.Couleur;
import java.util.ArrayList;
import java.util.List;
import outil.Action;

public class ActionBase implements Echiquier {

    int pIndexDep;
    List<Coups> pListeCoups;
    static boolean prise_en_passant;
    static Couleur _couleur;
    static int pIndexArr;
    static Piece pPieceDep;
    static int pDist;
    static int pIndexDir;
    static Piece[] PIECES;
    static boolean _examineEchecs;
    static List<Coups> pListeCoupsPart;
    static Action NewCoups;
    static Action NewArrayListCoups;
    static Action InitDir,  AjoutCoupsListe,  CaseSuivante;
    static Action DirSuivante,  DistSuivante,  InitDist,  InitIndex;

    public ActionBase() {
        NewCoups = new Action() {

            public void exec() {
                pIndexArr = ECHIQUIER[TO_ECHIQUIER[pIndexDep] +
                        pDist * pPieceDep.getDeplacement()[pIndexDir]];
                pListeCoupsPart.add(new Coups(pIndexDep, pPieceDep, pIndexArr));
            }
        };
        CaseSuivante = new Action() {

            @Override
            public void exec() {
                pIndexDep++;
            }
        };
        NewArrayListCoups = new Action() {

            public void exec() {
                pListeCoupsPart = new ArrayList<Coups>();
            }
        };
        DirSuivante = new Action() {

            public void exec() {
                pIndexDir++;
            }
        };
        DistSuivante = new Action() {

            public void exec() {
                pDist++;
            }
        };
        InitDist = new Action() {

            public void exec() {
                pDist = 1;
            }
        };
        InitIndex = new Action() {

            public void exec() {
                pDist = 1;
                pIndexDir = 0;
            }
        };
        InitDir = new Action() {

            public void exec() {
                pIndexDir = 0;
            }
        };
        AjoutCoupsListe = new Action() {

            public void exec() {
                pListeCoups.addAll(pListeCoupsPart);
            }
        };


    }

//    public static int indexArr(int pIndexDep) {
//        return ECHIQUIER[TO_ECHIQUIER[pIndexDep] +
//                pDist * pPieceDep.getDeplacement()[pIndexDir]];
//    }
}


